package com.wish233.wiliwilisearch.service.impl;

import com.wish233.wiliwilisearch.domain.result.SearchResponse;
import com.wish233.wiliwilisearch.manager.SearchManager;
import com.wish233.wiliwilisearch.manager.SearchManagerRegistry;
import com.wish233.wiliwilisearch.service.SearchService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


/**
 * @author WHH
 */
@Service
public class SearchServiceImpl implements SearchService {

    @Resource
    private SearchManagerRegistry searchManagerRegistry;

    @Override
    public SearchResponse searchByKeyWord(Integer searchType, String keyWord, Integer current, Integer pageSize) {
        SearchManager searchManager = searchManagerRegistry.getSearchManagerById(searchType);
        return searchManager.doSearchByKeyword(keyWord, current, pageSize);
    }
}
